import http from './index'

// 分页获取短信消息
export const getSMSs = ({ ascended = null, current = null, size = null, sortFieldName = null, status = null, title = null, type = null, source = null, state = null }) => {
    return http.get("sms", { ascended, current, size, sortFieldName, status, title, type, source, state })
}

// 新增短信消息
export const addSMS = ({ message, pushDatetime, title, type, note = null, state = null, status = null }) => {
    return http.post("sms", { message, pushDatetime, title, type, note, state, status })
}

// 批量删除短信消息
export const delSMSs = ({ sidList }) => {
    return http.put("sms/delete", { sidList })
}

// 查询具体短信消息内容
export const getSMSContent = ({ contentId }) => {
    return http.get("sms/" + contentId + "/message")
}

// 根据sid获取短信消息
export const getSMSDetail = ({ sid }) => {
    return http.get("sms/" + sid)
}

// 修改短信消息
export const editSMS = ({ sid, message, pushDatetime, title, type, note = null, state = null, status = null }) => {
    return http.put("sms/" + sid, { message, pushDatetime, title, type, note, state, status })
}

// 发布短信消息
export const releaseSMS = ({ sid }) => {
    return http.put("sms/" + sid + '/publishNow')
}

// 根据sid启用-停用短信消息
export const changeSMSStatus = ({ sid }) => {
    return http.put("sms/" + sid + '/status')
}

// 分页获取站内消息
export const getMessages = ({ ascended = null, current = null, size = null, sortFieldName = null, status = null, title = null, type = null, source = null, state = null }) => {
    return http.get("messages", { ascended, current, size, sortFieldName, status, title, type, source, state })
}

// 用户获取站内消息
export const getMessagesUnread = ({ ascended = null, current = null, size = null, sortFieldName = null } = {}) => {
    return http.get("messages/pc-unread", { ascended, current, size, sortFieldName })
}

// 查询具体站内消息内容
export const getMessageContent = ({ contentId }) => {
    return http.get("messages/" + contentId + "/message")
}

// 用户查阅站内消息
export const readMessage = ({ sid }) => {
    return http.put("messages/" + sid + '/read')
}

// 根据sid获取站内消息
export const getMessageDetail = ({ sid }) => {
    return http.get("messages/" + sid)
}

// 新增站内消息
export const addMessage = ({ message, pushDatetime, title, type, note = null, state = null, status = null }) => {
    return http.post("messages", { message, pushDatetime, title, type, note, state, status })
}

// 修改站内消息
export const editMessage = ({ sid, message, pushDatetime, title, type, note = null, state = null, status = null }) => {
    return http.put("messages/" + sid, { message, pushDatetime, title, type, note, state, status })
}

// 批量删除站内消息
export const delMessages = ({ sidList }) => {
    return http.put("messages/delete", { sidList })
}

// 根据sid启用-停用站内消息
export const changeMessageStatus = ({ sid }) => {
    return http.put("messages/" + sid + '/status')
}

// 发布站内消息
export const releaseMessage = ({ sid }) => {
    return http.put("messages/" + sid + '/publishNow')
}


